001 /*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016 package org.opengion.plugin.column;
017
018 import org.opengion.fukurou.util.StringUtil;
019 import org.opengion.fukurou.security.HybsCryptography ;
020 import org.opengion.hayabusa.db.AbstractDBType;
021
022 /**
023 * åŠè§?全角混在ã®ä¸?ˆ¬çš?ªåˆ¶é™ã?ãªã?š—å·åŒ–ã•ã‚ŒãŸæ–?—å?を扱ã?‚ºã®ã€ã‚«ãƒ©ãƒ?±žæ?を定義ã—ã¾ã™ã?
024 *
025 * ãƒã‚°ã‚¤ãƒ³èªè¨¼ã®ãƒ‘スワードãªã©ã¯ã€MD5ãªã©ã®ãƒãƒƒã‚·ãƒ¥ã‚³ãƒ¼ãƒ‰ã«å¤‰æ›ã™ã‚‹æ–¹å¼ãŒä½¿ãˆã¾ã™ã?
026 * ã“れã¯ã€?žå¯é€?¤‰æ›ãªã®ã§ã€å¤‰æ›å¾Œã?æ–?—å?ã¯ã€å?ã«æˆ»ã™ã“ã¨ã¯å‡ºæ¥ã¾ã›ã‚“ã€?
027 * ä¸?ˆ¬ã«ã¯ã€ã“ã®éžå¯é€?¤‰æ›ãŒä½¿ç”¨ã§ãã‚‹ã®ã§ã‚れã°ã€æ¼æ´©ã«å¯¾ã—ã¦ã¯å®‰å?ã§ã™ã?
028 * ã“ã?ã‚¯ãƒ©ã‚¹ã®æš—å·åŒ–ã?秘å¯?‚ーã«ã‚ˆã‚‹å¯é€?¤‰æ›ãªã®ã§ã€å¤‰æ›æ–¹å¼ã¨ç§˜å¯?‚ーãŒåˆ¤ã‚‹ã¨
029 * å…?«æˆ»ã™ã“ã¨ãŒå¯èƒ½ã§ã™ã?ãれã§ã‚‚ã?何もã—ãªã?‚ˆã‚Šã?ã¯ã‚‹ã‹ã«ã¾ã—ã§ã™ã?
030 * ãƒ??タベã?スç‰ã¸ç™»éŒ²ã—ãŸãƒ??タを戻ã—ã¦åˆ©ç”¨ã—ãŸã?Œã€ãã®ã¾ã¾æŠœã出ã•れるã?ã¯
031 * å›°ã‚‹å?åˆã«ã€ä½¿ç”¨ã§ãã¾ã™ã?
032 * ãªãŠã?æš—å·åŒ–ã™ã‚‹ãŸã‚ã?å…?ƒ‡ãƒ¼ã‚¿ã®æ•´åˆæ?ã§ã¯ãªãæš—å·åŒ–ã•れãŸå¾Œã?ãƒ??ã‚¿ã§ã®æ•´åˆæ?ã?
033 * ãƒã‚§ãƒ?‚¯ã•れã¾ã™ã?
034 *
035 * @og.rev 4.0.0.0 (2005/08/31) æ–°è¦ä½œæ?
036 * @og.group ãƒ??タ属æ?
037 *
038 * @version 4.0
039 * @author Kazuhiko Hasegawa
040 * @since JDK5.0,
041 */
042 public class DBType_CRYPT extends AbstractDBType {
043 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */
044 private static final String VERSION = "5.6.0.3 (2012/01/24)" ;
045
046 private final HybsCryptography licence = new HybsCryptography() ;
047
048 /**
049 * Stringå¼•æ•°ã®æ–?—å?を+1ã—ãŸæ–‡å—å?ã‚’è¿”ã—ã¾ã™ã?
050 * ※ ã“ã?クラスã§ã¯å®Ÿè£?•れã¦ã?¾ã›ã‚“ã€?
051 *
052 * @og.rev 5.6.0.3 (2012/01/24) ADD ã«ã€å¼•æ•°ã®å€¤ã‚’åŠ ç®—ã™ã‚‹æ©Ÿè?を追åŠ?—ã¾ã™ã?
053 *
054 * @param value String引数
055 * @param add åŠ?®—ã™ã‚‹æ–‡å—å?(null ã®å ´åˆã?ã€å¾“æ¥ã¨åŒã˜ã€?1 ã—ã¾ã™ã?)
056 *
057 * @return å¼•æ•°ã®æ–?—å?を+1ã—ãŸæ–‡å—å?。ã¾ãŸã?ã€ä»»æ„ã?å€¤ã‚’åŠ ç®—ã—ãŸæ–‡å—å?ã€?
058 * @throws UnsupportedOperationException ã“ã?クラスを実行ã™ã‚‹ã¨ã€å¿?šç™ºç”Ÿã—ã¾ã™ã?
059 */
060 @Override
061 // public String valueAdd( final String value ) {
062 public String valueAdd( final String value,final String add ) {
063 String errMsg = "ã“ã?メソãƒ?ƒ‰ã¯ã€ã“ã®ã‚¯ãƒ©ã‚¹ã‹ã‚‰ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“ã€?;
064 throw new UnsupportedOperationException( errMsg );
065 }
066
067 /**
068 * HybsCryptographyã«ã‚ˆã‚Šã€æš—å·åŒ–ã•ã‚ŒãŸæ–?—ã‚’è¿”ã—ã¾ã™ã?
069 *
070 * HybsCryptography クラスを使用ã—ãŸã€ç§˜å¯?‚ー暗å·åŒ–æ–¹å¼ã«ã‚ˆã‚Šã€ç™»éŒ²ãƒ??ã‚¿ã‚’æš—å·åŒ–ã—ã¾ã™ã?
071 * æš—å·åŒ–ã•れãŸãƒã‚¤ãƒˆæ–‡å—ã?ã€?¼‘ï¼–é?æ•°ã§æ–?—å?ã«å¤‰æ›ã—ã¦ã?¾ã™ã?
072 *
073 * @param value ä¸?ˆ¬ã«ç·¨é›?ƒ‡ãƒ¼ã‚¿ã¨ã—ã¦ç™»éŒ²ã•れãŸãƒ‡ãƒ¼ã‚¿
074 *
075 * @return ä¿®æ£å¾Œã?æ–?—å?(ä¸?ˆ¬ã«ãƒ??タベã?スã«ç™»éŒ²ã™ã‚‹ãƒ??ã‚¿)
076 */
077 @Override
078 public String valueSet( final String value ) {
079 return licence.encrypt( StringUtil.rTrim( value ) );
080 }
081 }